<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: #f99;
        }
    </style>
</head>

<body>

    <div>哈哈</div>
    <script>
        var div = document.querySelector('div');
        var res = window.getComputedStyle(div, null).backgroundColor;
        console.log(res);
        //shift rgba
    </script>
</body>

</html>